<?php
include_once("../configure/admin.config.inc.php");	//--> admin global var
include_once("db.inc.php");							//--> db global var
include_once("Smarty.class.php");					//--> out template
include_once("Operation.php");						//--> Operation
require_once("controlHeader.php");					//--> system control header
include_once("Country.php");						//--> Country

$objOperate = new Operation($sessionImpl->getLanguage());		//--> Operation
$objCountry	= new Country($uid);								//--> Country

$error_message 	= '';

$question	= '';
$answer		= '';
$status		= 'approved';

$arrOperate = $objOperate->arrGetFromGroupIDAndMenuID($gid, $menuid);
if(isset($_POST['Submit'])){
	$name	= $_POST['name'];
	$status	= $_POST['status'];
		
	if(empty($name))
		$error_message = 'name should\'t be empty.';
	else if(empty($namecn))
		$error_message = 'answer should\'t be empty.';
	else{
		$isReturn = $objCountry->add($arrOperate, $name, $status);
		if($isReturn)
			$error_message = 'add successfully.';
		else 
			$error_message = 'add failure.';
	}
}


$arrStatus	= array('approved' => 'approved', 'unapproved' => 'unapproved');

/*----- out html -----*/
$smarty = new Smarty();		//----- out template
$smarty->template_dir = TEMPLATE_SYS_DIR;
$smarty->compile_dir  = COMPILE_SYS_DIR;
$smarty->assign('menuGid', $menuGid);
$smarty->assign('menuid', $menuid);

$smarty->assign('backurl',$backurl);
$smarty->assign('error_message', $error_message);

$smarty->assign('name', $name);

$smarty->assign('arrStatus', $arrStatus);
$smarty->assign('statusS', $status);

$smarty->display('listCountry_Add.htm');
?>
